package com.quanshu.change.person.view;

import android.content.Intent;
import android.os.Bundle;
import android.support.constraint.ConstraintLayout;

import com.gyf.barlibrary.ImmersionBar;
import com.quanshu.exchange.R;
import com.quanshu.exchange.support.utils.RxViewHelper;
import com.quanshu.exchange.ui.base.BaseActivity;
import com.quanshu.exchange.ui.base.MyApplication;
import com.quanshu.exchange.ui.gui.login.LoginActivity;
import com.quanshu.shop.base.view.BaseTitleBar;

import butterknife.BindView;
import butterknife.ButterKnife;

public class HotGoodsActivity extends BaseActivity {

    @BindView(R.id.cl_line1)
    ConstraintLayout clLine1;
    @BindView(R.id.cl_line2)
    ConstraintLayout clLine2;
    @BindView(R.id.cl_line3)
    ConstraintLayout clLine3;
    @BindView(R.id.cl_line4)
    ConstraintLayout clLine4;
    public static final String HOT_LIMITE_ISINN = "5";
    public static final String HOT_SECKILL_ISINN = "4";
    public static final String HOT_LIMITE_TYPE = "";
    public static final String HOT_SECKILL_BUY_TYPE = "";
    public static final String HOT_SECKILL_GET_TYPE = "1";
    public static final String HOT_SECKILL_SELL_TYPE = "2";
    public static final String HOT_LIMITE_ISTYPE = "";
    public static final String HOT_SECKILL_BUY_ISTYPE = "";//购买
    public static final String HOT_SECKILL_GET_ISTYPE = "";//提货
    public static final String HOT_SECKILL_SELL1_ISTYPE = "1";//寄售中
    public static final String HOT_SECKILL_SELL2_ISTYPE = "2";//寄售成功
    public static final String HOT_SECKILL_SELL3_ISTYPE = "3";//寄售失败
    public static final String GOODS_ID = "goods_id";
    public static final String GOODS_TYPE = "goods_type";
    @BindView(R.id.title)
    BaseTitleBar title;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hot_goods);
        ButterKnife.bind(this);
        initView();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ImmersionBar.with(this).destroy();
    }

    private void initView() {
        title.setLeftImage(R.drawable.icon_back_black_2_0).setCenterText("好货特卖").setOnClickBaseTitleListener(new BaseTitleBar.OnClickBaseTitleBarListener() {
            @Override
            public void onclickLeft() {
                finish();
            }

            @Override
            public void onclickRight() {

            }
        });
        RxViewHelper.getInstance().clicks(clLine1, aVoid -> {
            //限购商品购买明细
            currentUser = MyApplication.getInstance().getCurrentUser();
            if (currentUser == null) {
                Intent intent = new Intent(this, LoginActivity.class);
                startActivity(intent);
                return;
            }
            Intent intent = new Intent(this, LimitedGoodsActivity.class);
            startActivity(intent);
        });
        RxViewHelper.getInstance().clicks(clLine2, aVoid -> {
            //秒杀商品购买明细
            currentUser = MyApplication.getInstance().getCurrentUser();
            if (currentUser == null) {
                Intent intent = new Intent(this, LoginActivity.class);
                startActivity(intent);
                return;
            }
            Intent intent = new Intent(this, SeckillGoodsBuyActivity.class);
            startActivity(intent);
        });
        RxViewHelper.getInstance().clicks(clLine3, aVoid -> {
            //秒杀商品提货明细
            currentUser = MyApplication.getInstance().getCurrentUser();
            if (currentUser == null) {
                Intent intent = new Intent(this, LoginActivity.class);
                startActivity(intent);
                return;
            }
            Intent intent = new Intent(this, SeckillGoodsGetActivity.class);
            startActivity(intent);
        });
        RxViewHelper.getInstance().clicks(clLine4, aVoid -> {
            //秒杀商品寄售明细
            currentUser = MyApplication.getInstance().getCurrentUser();
            if (currentUser == null) {
                Intent intent = new Intent(this, LoginActivity.class);
                startActivity(intent);
                return;
            }
            Intent intent = new Intent(this, SeckillGoodsSellActivity.class);
            startActivity(intent);
        });

    }
}
